package com.nts.visionworks.business.contents.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Range;

import com.nts.visionworks.core.validation.EntityIdNotNull;

/**
 * ContentsAttribute generated by hbm2java
 */
@Entity
@Table(name = "contents_attribute", catalog = "visionworks")
public class ContentsAttribute implements java.io.Serializable
{

	private Integer contentsAttributeId;
	private Contents contents;
	private ContentsTemplateAttribute contentsTemplateAttribute;
	private String attributeKey;
	private String attributeValue;

	public ContentsAttribute()
	{
	}

	public ContentsAttribute(Contents contents,
			ContentsTemplateAttribute contentsTemplateAttribute,
			String attributeKey, String attributeValue)
	{
		this.contents = contents;
		this.contentsTemplateAttribute = contentsTemplateAttribute;
		this.attributeKey = attributeKey;
		this.attributeValue = attributeValue;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ContentsAttributeId", unique = true, nullable = false)
	public Integer getContentsAttributeId()
	{
		return this.contentsAttributeId;
	}

	public void setContentsAttributeId(Integer contentsAttributeId)
	{
		this.contentsAttributeId = contentsAttributeId;
	}

	@EntityIdNotNull(message = "validation.contents.contentsAttribute.contents.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ContentsId", nullable = false)
	public Contents getContents()
	{
		return this.contents;
	}

	public void setContents(Contents contents)
	{
		this.contents = contents;
	}

	@EntityIdNotNull(message = "validation.contents.contentsAttribute.contentsTemplateAttribute.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns(
	{
			@JoinColumn(name = "TemplateId", referencedColumnName = "TemplateAttributeId", nullable = false),
			@JoinColumn(name = "TemplateAttributeId", referencedColumnName = "TemplateId", nullable = false) })
	public ContentsTemplateAttribute getContentsTemplateAttribute()
	{
		return this.contentsTemplateAttribute;
	}

	public void setContentsTemplateAttribute(
			ContentsTemplateAttribute contentsTemplateAttribute)
	{
		this.contentsTemplateAttribute = contentsTemplateAttribute;
	}

	@NotNull(message = "validation.contents.contentsAttribute.attributeKey.notNull")
	@Range(message = "validation.contents.contentsAttribute.attributeKey.length", max = 150, min = 1)
	@Column(name = "AttributeKey", nullable = false, length = 150)
	public String getAttributeKey()
	{
		return this.attributeKey;
	}

	public void setAttributeKey(String attributeKey)
	{
		this.attributeKey = attributeKey;
	}

	@NotNull(message = "validation.contents.contentsAttribute.attributeValue.notNull")
	@Range(message = "validation.contents.contentsAttribute.attributeValue.length", max = 1000, min = 1)
	@Column(name = "AttributeValue", nullable = false, length = 1000)
	public String getAttributeValue()
	{
		return this.attributeValue;
	}

	public void setAttributeValue(String attributeValue)
	{
		this.attributeValue = attributeValue;
	}

}
